import React, { Component } from 'react';

class MyGoodsLeft extends Component {
  state = {
    currentindex: 0
  }
  render() {
    return (
      <div className='left'>
        {
          this.props.list.map((item, index) => {
            return (
              <div key={item.id}
                className={"name " + (this.props.currentindex === index ? "red" : "")}
                onClick={() => { this.props.handeclick(index, item.id) }}
              >
                {item.name}
              </div>
            )
          })
        }

      </div>
    );
  }
}

export default MyGoodsLeft;